.PHONY: all install clean debian distclean

all:

install:
	cp etc/dust.conf $(DESTDIR)/etc/dust/dust.conf
	chmod 644 $(DESTDIR)/etc/dust/dust.conf
	cp etc/apache.conf $(DESTDIR)/etc/dust/apache.conf
	chmod 644 $(DESTDIR)/etc/dust/apache.conf
	cp etc/apache2.conf $(DESTDIR)/etc/dust/apache2.conf
	chmod 644 $(DESTDIR)/etc/dust/apache2.conf
	cp scripts/dust.pl $(DESTDIR)/usr/share/dust/dust.pl
	chmod 755 $(DESTDIR)/usr/share/dust/dust.pl
	cp scripts/dust-lib.pl $(DESTDIR)/usr/share/dust/dust-lib.pl
	chmod 755  $(DESTDIR)/usr/share/dust/dust-lib.pl

	cp scripts/install.pl $(DESTDIR)/usr/share/dust/install.pl
	chmod 755 $(DESTDIR)/usr/share/dust/install.pl
	cp scripts/remove.pl $(DESTDIR)/usr/share/dust/remove.pl
	chmod 755 $(DESTDIR)/usr/share/dust/remove.pl
	cp scripts/upgrade.pl $(DESTDIR)/usr/share/dust/upgrade.pl
	chmod 755 $(DESTDIR)/usr/share/dust/upgrade.pl

	install -D cache/refs/* $(DESTDIR)/var/cache/dust/refs
	install -D cache/store/* $(DESTDIR)/var/cache/dust/store

clean:
	find . -name '*~' | xargs -n 1 rm -f

debian:
	dpkg-buildpackage -rfakeroot -us -uc

distclean: clean
	rm -f build-arch-stamp
	rm -f build-indep-stamp
	rm -f configure-stamp
	rm -rf debian/dust
	rm -f debian/dust.substvars
